
<div class="row">
  <div class="col-sm-12">
   <div class="widget">
        <div class="widget-title">
             <h3>订单管理</h3>
             <span> {$count}条</span>
        </div>
        <div class="task-graph panel-body">
          <form class="form-inline" method="get" action="">
            <div class="form-group">
                <div class="input-group" style="margin-bottom: 0px;"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
        <input type="date" class="form-control input-inline " name="startDate" value="{:empty(input('startDate')) ? date('Y-m-d',strtotime('-3 Month',time())) : input('startDate')}" data-toggle="tooltip" title="" data-placement="top" data-original-title="选择开始时间" id="datepicker" >
        {if request()->isMobile()}
        </div>
        <div class="form-group">
        {/if}
            <span class="input-group-addon">至</span>
        <input type="date" class="form-control input-inline " name="endDate" data-toggle="tooltip" title="" data-placement="top" data-original-title="选择结束时间" id="datepicker2" value="{:empty(input('endDate')) ? date('Y-m-d',time()) : input('endDate')}">
                </div>
              </div>
            <div class="form-group">
              <select name="status" class="form-control" data-toggle="tooltip" title="" data-placement="top" data-original-title="选择支付状态">
                <option value="" selected="">全部</option>
                <option value="0" {if condition="input('status') eq '0'"} selected="selected" {/if}>待付款</option>
                <option value="1" {if condition="input('status') eq '1'"} selected="selected" {/if}>已付款</option>
              </select>
            </div>
            <div class="form-group">
              <select class="form-control" name="type" data-toggle="tooltip" title="" data-placement="top" data-original-title="选择支付通道">
                <option value="" selected="">全部通道</option>
                <option value="qqpay" {if condition="input('type') eq 'qqpay'"} selected="selected" {/if}>QQ钱包</option>
                <option value="alipay" {if condition="input('type') eq 'alipay'"} selected="selected" {/if}>支付宝</option>
                <option value="wxpay" {if condition="input('type') eq 'wxpay'"} selected="selected" {/if}>微信</option>
              </select>
            </div>
            <div class="form-group">
              <input type="text" class="form-control" name="trade_no" placeholder="{$site.name}系统订单号" data-toggle="tooltip" title="" data-placement="top" data-original-title="{$site.name}系统订单号" value="{:input('trade_no')}">
            </div>
            <div class="form-group">
              <input type="text" class="form-control" name="out_trade_no" placeholder="输入商户订单号" data-toggle="tooltip" title="" data-placement="top" data-original-title="输入商户订单号" value="{:input('out_trade_no')}">
            </div>
            <div class="form-group">
              <input type="text" class="form-control" name="money" placeholder="输入商品金额" value="{:input('money')}">
            </div>
            <button type="submit" class="btn btn-primary" style="margin-bottom: 0px;"><span class="glyphicon glyphicon-search"></span>搜索</button>
          </form>
          <hr>
            <div class="table-responsive">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                          <th>系统订单号</th>
                          <th>商户订单号</th>
                          <th>支付方式</th>
                          <th>状态</th>
                          <th>名称</th>
                          <th>金额</th>
                          <th>创建时间</th>
                          <th>结束时间</th>
                          <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {volist name="res" id="vo" empty="<td colspan='10' class='text-center'>暂无订单数据.</td>"}
                        <tr>
                          <td>{$vo.trade_no}</td>
                          <td>{$vo.out_trade_no}</td>
                          <td>{$vo.type_text}</td>
                          <td>{if condition="$vo.status eq 1"}
                              <span class="label label-success"> 已付款</span>
                              {else /}
                              <span class="label label-warning"> 未支付</span>
                              {/if}</td>
                          <td>{$vo.title}</td>
                          <td>{$vo.money}</td>
                         <td>{:date('Y-m-d H:i:s',$vo.createtime)}</td>
                          <td>{$vo.updatetime ? date('Y-m-d H:i:s',$vo.updatetime) : '无'}</td>
                          <td>
                          {if condition="$vo.status eq 1"}
                          {php}
                            $array=[
                                'pid'=>$user['api_id'],
                                'trade_no'=>$vo['trade_no'],
                                'out_trade_no'=>$vo['out_trade_no'],
                                'type'=>$vo['type'],
                                'name'=>$vo['title'],
                                'money'=>round($vo['money'],2),
                                'trade_status'=>'TRADE_SUCCESS'
                            ];
                            $arg = argSort(paraFilter($array));
                            $prestr = createLinkstring($arg);
                            $urlstr = createLinkstringUrlencode($arg);
                            $sign = md5Sign($prestr, $user['api_key']);
                            $n = strpos($vo['return_url'],'?') ? '&' : '?';
                            $url = $vo['return_url'].$n.$urlstr.'&sign='.$sign.'&sign_type=MD5';
                    {/php}
                          <a href="{$url}" target="_blank" class="label label-primary">补单</a>
                          {else /}
                          无
                          {/if}
                    </td>
                      </tr>
                      {/volist}
                    </tbody>
                </table>
            </div>
            {$res->render()}
        </div>
    </div>
</div>